package com.larly.model.enums.notification;

import lombok.Getter;

/**
 * 通知类型枚举
 */
@Getter
public enum NotificationTypeEnum {

    /**
     * 点赞通知
     */
    LIKE(1, "点赞"),

    /**
     * 评论通知
     */
    COMMENT(2, "评论"),

    /**
     * 关注通知
     */
    FOLLOW(3, "关注"),

    /**
     * 私信通知
     */
    PRIVATE_MESSAGE(4, "私信");


    private final int code;
    private final String description;

    NotificationTypeEnum(int code, String description) {
        this.code = code;
        this.description = description;
    }

    /**
     * 根据code获取通知类型
     *
     * @param code 通知类型code
     * @return 对应的通知类型枚举
     */
    public static NotificationTypeEnum fromCode(int code) {
        for (NotificationTypeEnum type : NotificationTypeEnum.values()) {
            if (type.getCode() == code) {
                return type;
            }
        }
        return null;
    }
}

